package com.bookcloud.java21.chapter5.返回对象54;

public class ReturnObject {
  public static void main(String[] args) {
    CreateFactory factory = new CreateFactory();
    // 调用工厂方法创建对象,point保存了对象引用
    Point point = factory.createPoint(10, 20);
    // 调用对象的方法
    System.out.println("point的坐标为:(" + point.getX() + "," + point.getY() + ")");
    // 调用当前的点
    factory.movePoint(point, 100, 200);
    System.out.println("point的坐标为:(" + point.getX() + "," + point.getY() + ")");
  }
}
